import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'

Vue.use(Vuex)

export default new Vuex.Store({
  modules: {
    user
  },
  getters: {
    token (state) {
      // 快捷访问
      //
      return state.user.token
    },
    // 对用户信息的快捷访问
    username: state => state.user.userinfo.name,
    avatar: state => state.user.userinfo.avatar

  }
})
